package com.ldc.work_1203.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ldc.work_1203.bean.Inquire;
import com.ldc.work_1203.bean.Jobinfo;
import com.ldc.work_1203.mapper.InquireMapper;
import com.ldc.work_1203.service.InquireService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InquireServiceImpl implements InquireService {

    @Autowired
    private InquireMapper inquireMapper;

    @Override
    public PageInfo<Inquire> getListInquire(String studentName, String companyName, Double miaPay, Double maxPay, Integer currentPage) {

        if (currentPage == null){
            currentPage = 1;
        }
        PageHelper.startPage(currentPage,2);

        List<Inquire> listInquire = inquireMapper.getListInquire(studentName, companyName, miaPay, maxPay);

        PageInfo<Inquire> inquirePageInfo = new PageInfo(listInquire,10);

        return inquirePageInfo;
    }

    @Override
    public void addInquire(Jobinfo jobinfo) {
        inquireMapper.addInquire(jobinfo);
    }

    @Override
    public Jobinfo getJobinfo(Integer JobinfoId) {
        return inquireMapper.getJobinfo(JobinfoId);
    }

    @Override
    public void upInquire(Jobinfo jobinfo) {
        inquireMapper.upInquire(jobinfo);
    }

    @Override
    public void delInquire(Integer jobinfoId) {
        inquireMapper.delInquire(jobinfoId);
    }
}
